#必须先有类别表及数据
import os
import pymysql

# insert into category (id,cate_name) values
# (1,"手机"),
# (2,"电视机"),
# (3,"空调"),
# (4,"洗衣机"),
# (5,"保护套"),
# (6,"保护膜"),
# (7,"充电器"),
# (8,"充电宝");
#
# cate_data = [
#     (1,"手机"),
#     (2,"电视机"),
#     (3,"空调"),
#     (4,"洗衣机"),
#     (5,"保护套"),
#     (6,"保护膜"),
#     (7,"充电器"),
#     (8,"充电宝")
# ]
#
# conn = pymysql.connect(host="localhost", port=3306, user='root', password='123', database='dami')
# cursor = conn.cursor()
#
# # cursor.execute("delete from goods;")
# cursor.executemany("insert into category (`id`,`cate_name`) values(%s,%s)", cate_data)
#
#
# conn.commit()
# cursor.close()
# conn.close()
#
# data = [
#  (1,'Redmi K50 电竞版',1,'120Hz流速屏，全速热爱','120Hz高帧率流速屏/ 索尼6400万前后六摄 / 6.67 / 小孔径全面屏 / 最高可选8GB+256GB大存储 / 高通骁龙730G处理器 / 3D四曲面玻璃机身 / 4500mAh+27W快充 / 多功能NFC','http://106.15.179.105:3000/public/imgs/phone/Redmi-K50-电竞版.jpg',2000,1599,10,0,1),
#  (2,'Redmi Note11 5G',1,'双模5G,120Hz流速屏','双模5G / 三路并发 / 高通骁龙765G / 7nm 5G低功耗处理器 / 120Hz高帧率流速屏 / 6.67 / 小孔径全面屏 / 索尼6400万前后六摄 / 最高可选8GB+256GB大存储 / 4500mAh+30W快充 / 3D四曲面玻璃机身 / 多功能NFC','http://106.15.179.105:3000/public/imgs/phone/Redmi-Note11-5G.jpg',2599,2599,10,0,1),
#  (3,'Xiaomi 12',1,'1亿像素,五摄四闪','1亿像素主摄 / 全场景五摄像头 / 四闪光灯 / 3200万自拍 / 10 倍混合光学变焦，50倍数字变焦 / 5260mAh ⼤电量 / 标配 30W疾速快充 / ⼩米⾸款超薄屏下指纹 / 德国莱茵低蓝光认证 / 多功能NFC / 红外万能遥控 / 1216超线性扬声器','http://106.15.179.105:3000/public/imgs/phone/Xiaomi-12.jpg',2799,2599,20,0,1),
#  (4,'Xiaomi 12 Pro',1,'5000mAh超长续航','5000mAh超长续航 / 高通骁龙439八核处理器 / 4GB+64GB','http://106.15.179.105:3000/public/imgs/phone/Xiaomi-12-Pro.jpg',799,699,20,0,1),
#  (5,'Xiaomi 12X',1,'5000mAh超长续航','5000mAh超长续航 / 高通骁龙439八核处理器 / 4GB+64GB / 1200万AI后置相机','http://106.15.179.105:3000/public/imgs/phone/Xiaomi-12X.jpg',599,699,20,0,1),
#  (6,'Redmi Note11 Pro',1,'6400万全场景四摄','6400万四摄小金刚拍照新旗舰超强解析力，超震撼','http://106.15.179.105:3000/public/imgs/phone/Redmi-Note11-Pro.jpg',1399,1199,20,0,1),
#  (7,'Redmi Note11 4G',1,'千元4800万四摄','千元4800万四摄 | 高通骁龙665 | 小金刚品质保证','http://106.15.179.105:3000/public/imgs/phone/Redmi-Note11-4G.jpg',999,999,20,0,1),
#  (8,'Xiaomi 11 青春活力版',1,'小巧大电量 持久流畅','小巧大电量，持久又流畅骁龙8核高性能处理器 | 4000mAh超长续航 | AI人脸解锁 | 整机防泼溅','http://106.15.179.105:3000/public/imgs/phone/Xiaomi-11-青春活力版.jpg',599,539,20,0,1),
#
#  (9,'小米电视4A 32英寸',2,'人工智能系统，高清液晶屏','小米电视4A 32英寸 | 64位四核处理器 | 1GB+4GB大内存 | 人工智能系统','http://106.15.179.105:3000/public/imgs/appliance/小米电视4A-32英寸.jpg',799,799,10,0,1),
#  (10,'小米全面屏电视E55A',2,'全面屏设计，人工智能语音','全面屏设计 | 内置小爱同学 | 4K + HDR | 杜比DTS | PatchWall | 海量内容 | 2GB + 8GB大存储 | 64位四核处理器','http://106.15.179.105:3000/public/imgs/appliance/小米全面屏电视E55A.jpg',2099,1899,10,0,1),
#  (11,'小米全面屏电视E65A',2,'全面屏设计，人工智能语音','人工智能语音系统 | 海量影视内容 | 4K 超高清屏 | 杜比音效 | 64位四核处理器 | 2GB + 8GB大存储','http://106.15.179.105:3000/public/imgs/appliance/小米全面屏电视E65A.jpg',3999,2799,10,0,1),
#  (12,'小米电视ES55 2022款',2,'FHD全高清屏，人工智能语音','人工智能语音系统 | FHD全高清屏 | 64位四核处理器 | 海量片源 | 1GB+8GB大内存 | 钢琴烤漆','http://106.15.179.105:3000/public/imgs/appliance/小米电视ES55-2022款.jpg',1499,1299,10,0,1),
#  (13,'小米电视6 至尊版 65英寸',2,'4K HDR，人工智能系统','人工智能 | 大内存 | 杜比音效 | 超窄边 | 4K HDR | 海量片源 | 纤薄机身| 钢琴烤漆','http://106.15.179.105:3000/public/imgs/appliance/小米电视6-至尊版-65英寸.jpg',1999,1799,10,0,1),
#  (14,'小米电视6 65 OLED',2,'4K HDR，人工智能系统','人工智能 | 大内存 | 杜比音效 | 超窄边 | 4K HDR | 海量片源 | 纤薄机身| 钢琴烤漆','http://106.15.179.105:3000/public/imgs/appliance/小米电视6-65-OLED.jpg',2999,2799,10,0,1),
#  (15,'小米壁画电视 65英寸',2,'壁画外观，全面屏，远场语音','纯平背板 | 通体13.9mm | 远场语音 | 4K+HDR | 杜比+DTS | 画框模式 | 内置小爱同学 | PatchWall | SoundBar+低音炮 | 四核处理器+大存储','http://106.15.179.105:3000/public/imgs/appliance/小米壁画电视-65英寸.jpg',6999,6999,10,0,1),
#  (16,'米家互联网空调C1（一级能效）',3,'变频节能省电，自清洁','一级能效 | 1.5匹 | 全直流变频 | 高效制冷/热 | 静音设计 | 自清洁 | 全屋互联','http://106.15.179.105:3000/public/imgs/appliance/米家互联网空调C1.jpg',2699,2599,20,10,1),
#  (17,'米家空调',3,'出众静音，快速制冷热','大1匹 | 三级能效 | 静音 | 快速制冷热 | 广角送风 | 除湿功能 | 高密度过滤网 | 典雅外观','http://106.15.179.105:3000/public/imgs/appliance/米家空调.jpg',1799,1699,20,8,1),
#  (18,'米家互联网洗烘一体机 Pro 10kg',4,'智能洗烘，省心省力','国标双A+级洗烘能力 / 22种洗烘模式 / 智能投放洗涤剂 / 支持小爱同学语音遥控 / 支持OTA在线智能升级 / 智能空气洗 / 除菌率达99.9%+','http://106.15.179.105:3000/public/imgs/appliance/米家互联网洗烘一体机-Pro-10kg.jpg',2999,2999,20,7,1),
#
#  (19,'Redmi K20/ K20 Pro 怪力魔王保护壳',5,'怪力魔王专属定制','优选PC材料，强韧张力，经久耐用 / 精选开孔，全面贴合机身 / 手感轻薄细腻，舒适无负担 / 三款颜色可选，彰显个性，与众不同','http://106.15.179.105:3000/public/imgs/accessory/Redmi-K20-Pro-怪力魔王保护壳.jpg',39,39,20,10,1),
#  (20,'小米9 ARE U OK保护壳',5,'一个与众不同的保护壳','彰显独特个性 / 轻薄无负担 / 优选PC材料 / 贴合机身 / 潮流五色','http://106.15.179.105:3000/public/imgs/accessory/小米9-ARE-U-OK保护壳.jpg',49,39,20,10,1),
#  (21,'小米CC9&小米CC9美图定制版 标准高透贴膜',6,'高清透亮，耐磨性强','耐磨性强，防护更出众 / 疏油疏水，有效抗水抗脏污 / 高清透亮，保留了原生屏幕的亮丽颜色和清晰度 / 操作灵敏，智能吸附 / 进口高端PET材质，裸机般手感','http://106.15.179.105:3000/public/imgs/accessory/小米CC9&小米CC9美图定制版-标准高透贴膜.jpg',19,19,20,9,1),
#  (22,'小米CC9e 标准高透贴膜',6,'高清透亮，耐磨性强','耐磨性强，防护更出众 / 疏油疏水，有效抗水抗脏污 / 高清透亮，保留了原生屏幕的亮丽颜色和清晰度 / 操作灵敏，智能吸附 / 进口高端PET材质，裸机般手感','http://106.15.179.105:3000/public/imgs/accessory/小米CC9&小米CC9美图定制版-标准高透贴膜.jpg',19,19,20,9,1),
#
#  (23,'小米USB充电器120W快充版（1A1C）',7,'多一种接口，多一种选择','双口输出 / 30W 输出 / 可折叠插脚 / 小巧便携','http://106.15.179.105:3000/public/imgs/accessory/小米充电器120W-白色.jpg',59,59,20,8,1),
#  (24,'黑鲨120W快充',7,'安卓、苹果设备均可使用','支持QC3.0设备充电 / 支持iOS设备充电/ 美观耐用','http://106.15.179.105:3000/public/imgs/accessory/黑鲨120W快充.jpg',29,29,20,8,1),
#  (25,'小米USB充电器67W快充版（6口）',7,'6口输出，USB-C输出接口','6口输出 / USB-C输出接口 / 支持QC3.0快充协议 / 总输出功率60W','http://106.15.179.105:3000/public/imgs/accessory/小米67W充电器套装.jpg',129,129,20,0,1),
#  (26,'黑鲨120W快充',7,'6多重安全保护，小巧便携','双USB输出接口 / 支持QC3.0快充协议 / 多重安全保护 / 小巧便携','http://106.15.179.105:3000/public/imgs/accessory/黑鲨120W快充.jpg',59,59,20,0,1),
#
#  (27,'小米车载充电器快充版',7,'让爱车成为移动充电站','QC3.0 双口输出 / 智能温度控制 / 5重安全保护 / 兼容iOS&Android设备','http://106.15.179.105:3000/public/imgs/accessory/小米车载充电器快充版.jpg',69,69,20,0,1),
#  (28,'小米车载充电器快充版(37W)',7,'双口快充，车载充电更安全','单口27W 快充 / 双口输出 / 多重安全保护','http://106.15.179.105:3000/public/imgs/accessory/小米车载充电器快充版37W.jpg',49,49,20,0,1),
#  (29,'小米二合一移动电源（充电器）',7,'一个设备多种用途','5000mAh充沛电量 / 多协议快充 / USB 口输出','http://106.15.179.105:3000/public/imgs/accessory/小米二合一移动电源.jpg',99,99,20,0,1),
#  (30,'小米无线充电宝青春版10000mAh',8,'能量满满，无线有线都能充','10000mAh大容量 / 支持边充边放 / 有线无线都能充 / 双向快充','http://106.15.179.105:3000/public/imgs/accessory/小米无线充电宝青春版.jpg',129,129,20,8,1),
#
#
#  (31,'小米CC9 Pro/尊享版 撞色飘带保护壳',5,'全面贴合，无感更舒适','优选环保PC材质，强韧张力，全面贴合，无感更舒适','http://106.15.179.105:3000/public/imgs/accessory/撞色飘带保护壳.jpg',69,69,20,0,1),
#  (32,'Redmi K20系列 幻境之心保护壳',5,'柔软坚韧,全面贴合','优质环保材质，柔软坚韧 / 全面贴合，有效抵抗灰尘 / 鲜亮三种颜色可选，为爱机随时换装','http://106.15.179.105:3000/public/imgs/accessory/1.jpg',39,39,20,0,1),
#  (33,'小米9 SE 街头风保护壳黑色',5,'个性时尚,细节出众','个性时尚 / 细节出众 / 纤薄轻巧 / 多彩时尚','http://106.15.179.105:3000/public/imgs/accessory/3.jpg',49,49,20,0,1),
#  (34,'小米9 街头风保护壳 红色',5,'个性时尚,细节出众','时尚多彩 / 细节出众 / 纤薄轻巧 / 是腕带也是支架','http://106.15.179.105:3000/public/imgs/accessory/4.jpg',49,49,20,0,1),
#  (35,'小米MIX 3 极简保护壳蓝色',5,'时尚简约设计，手感细腻顺滑','时尚简约设计，手感细腻顺滑 / 优质环保PC原材料，强韧张力，经久耐用 / 超薄 0.8MM厚度','http://106.15.179.105:3000/public/imgs/accessory/极简蓝色.jpg',49,12.9,20,0,1)
#
# ]
#
#
#
# # 插入商品数据
# data_list = [list(i) for i in data]
#
# for idx, good in enumerate(data_list):
#     base = os.path.basename(good[5])
#     img = os.path.join("/static/images", base)
#
#     # print("xxx:", img)
#     good[5] = img
#
#     data_list[idx] = good
#
# print(data_list[:10])
#
#
# conn = pymysql.connect(host="localhost", port=3306, user='root', password='123', database='dami')
# cursor = conn.cursor()
#
# # cursor.execute("delete from goods;")
# cursor.executemany("insert into goods"
#                    "(`id`,`sku_name`,`cate_id`,`title`,`instruction`,`img`,`price`,`selling_price`,`stock`,`count`,`online`) "
#                    "values(%s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s)", data_list)
#
#
#
# conn.commit()
# cursor.close()
# conn.close()
#
#
# # 插入图片数据
# #(`id`,`good_id`,`img`,`title`)
# null = None
# images = [
# (1,1,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi-k30-1.png',null),
# (2,1,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi-k30-2.png',null),
# (3,1,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi-k30-3.png',null),
# (4,1,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi-k30-4.png',null),
# (5,1,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi-k30-5.png',null),
#
# (6,2,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi K30 5G-1.jpg',null),
# (7,2,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi K30 5G-2.jpg',null),
# (8,2,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi K30 5G-3.jpg',null),
# (9,2,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi K30 5G-4.jpg',null),
# (10,2,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi K30 5G-5.jpg',null),
#
# (11,3,'http://106.15.179.105:3000/public/imgs/phone/picture/MI CC9 Pro-1.jpg',null),
# (12,3,'http://106.15.179.105:3000/public/imgs/phone/picture/MI CC9 Pro-2.jpg',null),
# (13,3,'http://106.15.179.105:3000/public/imgs/phone/picture/MI CC9 Pro-3.jpg',null),
# (14,3,'http://106.15.179.105:3000/public/imgs/phone/picture/MI CC9 Pro-4.jpg',null),
# (15,3,'http://106.15.179.105:3000/public/imgs/phone/picture/MI CC9 Pro-5.jpg',null),
# (16,3,'http://106.15.179.105:3000/public/imgs/phone/picture/MI CC9 Pro-6.jpg',null),
#
# (17,4,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 8-1.jpg',null),
# (18,4,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 8-2.jpg',null),
# (19,4,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 8-3.jpg',null),
# (20,4,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 8-4.jpg',null),
# (21,4,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 8-5.jpg',null),
#
#
# (22,5,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 8A-1.jpg',null),
#
#
# (23,6,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8 Pro-1.png',null),
# (24,6,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8 Pro-2.png',null),
# (25,6,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8 Pro-3.png',null),
# (26,6,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8 Pro-4.png',null),
# (27,6,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8 Pro-5.png',null),
#
#
# (28,7,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8-1.jpg',null),
# (29,7,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8-2.jpg',null),
# (30,7,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8-3.jpg',null),
# (31,7,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8-4.jpg',null),
# (32,7,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi Note8-5.jpg',null),
#
#
# (33,8,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 7A-1.jpg',null),
# (34,8,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 7A-2.jpg',null),
# (35,8,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 7A-3.jpg',null),
# (36,8,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 7A-4.jpg',null),
# (37,8,'http://106.15.179.105:3000/public/imgs/phone/picture/Redmi 7A-5.jpg',null),
#
# (38,9,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4A-32-1.jpg',null),
#
# (39,9,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4A-32-2.jpg',null),
# (40,9,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4A-32-3.jpg',null),
# (41,9,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4A-32-4.jpg',null),
#
#
# (42,10,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-E55A-1.jpg',null),
# (43,10,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-E55A-2.jpg',null),
# (44,10,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-E55A-3.jpg',null),
# (45,10,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-E55A-4.jpg',null),
#
#
# (46,11,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-E65A-1.jpg',null),
# (47,11,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-E65A-2.jpg',null),
# (48,11,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-E65A-3.jpg',null),
# (49,11,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-E65A-4.jpg',null),
#
# (50,12,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4X 43-1.jpg',null),
# (51,12,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4X 43-2.jpg',null),
# (52,12,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4X 43-3.jpg',null),
#
# (53,13,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4C 55-1.jpg',null),
# (54,13,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4C 55-2.jpg',null),
# (55,13,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4C 55-3.jpg',null),
#
# (56,14,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-4A 65-1.jpg',null),
#
# (57,15,'http://106.15.179.105:3000/public/imgs/phone/picture/MiTv-ArtTv-65-1.jpg',null),
#
# (58,16,'http://106.15.179.105:3000/public/imgs/phone/picture/AirCondition-V1C1-1.jpg',null),
# (59,17,'http://106.15.179.105:3000/public/imgs/phone/picture/AirCondition-F3W1-1.jpg',null),
#
# (60,18,'http://106.15.179.105:3000/public/imgs/phone/picture/Washer-Pro-10-1.jpg',null),
# (61,18,'http://106.15.179.105:3000/public/imgs/phone/picture/Washer-Pro-10-2.jpg',null),
# (62,18,'http://106.15.179.105:3000/public/imgs/phone/picture/Washer-Pro-10-3.jpg',null),
# (63,18,'http://106.15.179.105:3000/public/imgs/phone/picture/Washer-Pro-10-4.jpg',null),
#
# (64,19,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingShell-RedMi-K20&pro-1.jpg',null),
#
# (65,20,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingShell-Mi-9-1.jpg',null),
# (66,20,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingShell-Mi-9-2.jpg',null),
#
# (67,21,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingMen-Mi-CC9-1.jpg',null),
# (68,22,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingMen-Mi-CC9e-1.jpg',null),
#
# (69,23,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-30w-1.jpg',null),
# (70,23,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-30w-2.jpg',null),
# (71,23,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-30w-3.jpg',null),
# (72,23,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-30w-4.jpg',null),
#
# (73,24,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-18w-1.jpg',null),
# (74,24,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-18w-2.jpg',null),
# (75,24,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-18w-3.jpg',null),
#
#
# (76,25,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-60w-1.jpg',null),
# (77,25,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-60w-2.jpg',null),
# (78,25,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-60w-3.jpg',null),
# (79,25,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-60w-4.jpg',null),
#
# (80,26,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-36w-1.jpg',null),
# (81,26,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-36w-2.jpg',null),
# (82,26,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-36w-3.jpg',null),
# (83,26,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-36w-4.jpg',null),
# (84,26,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-36w-5.jpg',null),
#
# (85,27,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-1.jpg',null),
# (86,27,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-2.jpg',null),
# (87,27,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-3.jpg',null),
# (88,27,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-4.jpg',null),
# (89,27,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-5.jpg',null),
# (90,27,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-6.jpg',null),
#
# (91,28,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-37w-1.jpg',null),
# (92,28,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-37w-2.jpg',null),
# (93,28,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-37w-3.jpg',null),
# (94,28,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-37w-4.jpg',null),
# (95,28,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-car-37w-5.jpg',null),
#
# (96,29,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-tio-1.jpg',null),
# (97,29,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-tio-2.jpg',null),
# (98,29,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-tio-3.jpg',null),
# (99,29,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-tio-4.jpg',null),
# (100,29,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-tio-5.jpg',null),
#
# (101,30,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-10000mAh-1.jpg',null),
# (102,30,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-10000mAh-2.jpg',null),
# (103,30,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-10000mAh-3.jpg',null),
# (104,30,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-10000mAh-4.jpg',null),
# (105,30,'http://106.15.179.105:3000/public/imgs/phone/picture/charger-10000mAh-5.jpg',null),
#
# (106,31,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingShell-Mi-CC9Pro-1.jpg',null),
# (107,32,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingShell-RedMi-K20-1.jpg',null),
# (108,33,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingShell-Mi-9SE-1.jpg',null),
# (109,34,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingShell-Mi-9-red-1.jpg',null),
# (110,35,'http://106.15.179.105:3000/public/imgs/phone/picture/protectingShell-Mix-3-1.jpg',null)
# ]
# images_list = [list(i) for i in images]
# target_images = []
# for good in data_list:
#     for img in images_list:
#         if good[0] == img[1]:
#            img[2] = "/static/images/" + os.path.basename(good[5])
#            target_images.append(img)
#     print("\n", target_images)
#     # break
#
# conn = pymysql.connect(host="localhost", port=3306, user="root", password='123', database='dami')
# cursor = conn.cursor()
# # 清空商品图片表
# # cursor.execute("delete from goodimg;")
# cursor.executemany("insert into goodimg (`id`,`good_id`,`img`,`title`) values(%s,%s,%s,%s)", target_images)
#
# conn.commit()
# cursor.close()
# conn.close()


# 添加轮播图数据
carousels = [
    [1, '/static/images/carousel/Redmi_Note_8.jpg','Redmi Note 8'],
    [2, '/static/images/carousel/Redmi_Note_8_Pro.jpg', 'Redmi Note 8 Pro'],
    [3, '/static/images/carousel/小米10.jpg', '小米10'],
    [4, '/static/images/carousel/洗烘一体机.jpg', '洗烘一体机']
]

conn = pymysql.connect(host="localhost", port=3306, user="root", password='123', database='dami')
cursor = conn.cursor()

cursor.executemany("insert into carousel_t (`id`,`imgPath`,`describes`) values(%s,%s,%s)", carousels)
conn.commit()
cursor.close()
conn.close()


